<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="type" id="type" value="23">
            <a id="subBtn" name="subOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-save l-btn-icon-left">保存</span></span></a>
            <a class="easyui-linkbutton l-btn l-btn-plain" id="commitBtn" iconcls="icon-redo" plain="true"
                onclick="commit();" style="display:none"><span class="l-btn-left"><span
                        class="l-btn-text icon-redo l-btn-icon-left">提交</span></span></a>
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1" style="width:160px;">
                        申请人：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear0" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('applyUserName,applyUserId');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        供应商评审申请表：
                    </td>
                    <td colspan="3">
                        <input type="text" name="projectName" id="projectName" data-options="required:true"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="projectId" id="projectId">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear1" iconcls="icon-undo" plain="true"
                            onclick="clearProject();"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                        <span style="margin-left:2px;" id="toView"></span>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        前置审批：
                    </td>
                    <td colspan="3">
                        <input type="text" name="approvalNames" id="approvalNames" value="王博宇"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="approvalIds" id="approvalIds" value="572">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear2" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('approvalNames,approvalIds');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        财务：
                    </td>
                    <td colspan="3">
                        <input type="text" name="financename" id="financename"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="financeid" id="financeid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear3" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('managername,managerid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear4" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('managername,managerid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        董事长：
                    </td>
                    <td colspan="3">
                        <input type="text" name="presidentname" id="presidentname"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="presidentid" id="presidentid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear5" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('presidentname,presidentid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        签约单位名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="companyName" id="companyName" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        合同名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="contractName" id="contractName" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        合同金额：
                    </td>
                    <td style="width:36%">
                        <input type="text" id="money" data-options="required:true"
                            class="easyui-numberbox numberbox-f validatebox-text" precision="2"
                            numberboxname="money"><input type="hidden" name="money" value="">
                    </td>
                    <td class="tdc1" style="width:160px;">
                        合同类型：
                    </td>
                    <td>
                        <select name="contractType" id="contractType" onchange="isOther(this.value)"
                            data-options="required:true" class="easyui-validatebox validatebox-text">
                            <option value="1">采购</option>
                            <option value="2">凭租</option>
                            <option value="3">合作</option>
                            <option value="4">服务</option>
                            <option value="5">其他</option>
                        </select>
                    </td>
                </tr>
                <tr id="othertr" style="display:none">
                    <td class="tdc1">
                        其他：
                    </td>
                    <td colspan="3">
                        <input type="text" name="otherthing" id="otherthing"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        合同内容：
                    </td>
                    <td colspan="3">
                        <textarea name="content" id="content" style="width:70%;height:60px"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        付款时间：
                    </td>
                    <td>
                        <input type="text" name="payDateStr" id="payDateStr"
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1">
                        付款方式：
                    </td>
                    <td>
                        <select name="payType" id="payType" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                            <option value="1">电汇</option>
                            <option value="2">支票</option>
                            <option value="3">现金</option>
                            <option value="4">个人垫付</option>
                            <option value="5">对公转账</option>

                        </select>
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        发票类型：
                    </td>
                    <td>
                        <input type="text" name="invoiceType" id="invoiceType"
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1">
                        税点：
                    </td>
                    <td>
                        <input type="text" name="taxPoint" id="taxPoint" class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        开票内容：
                    </td>
                    <td>
                        <select name="invoiceContent" id="invoiceContent" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                            <option value="1">装修款</option>
                        </select>
                    </td>
                    <td class="tdc1">
                        开票内容(其他)：
                    </td>
                    <td>
                        <input type="text" name="other" id="other" class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        质保期限：
                    </td>
                    <td colspan="3">
                        <textarea name="warrantyperiod" id="warrantyperiod" style="width:70%;height:70px"></textarea>
                    </td>
                </tr>


                <tr>
                    <td class="tdc1">
                        相关附件：
                    </td>
                    <td>
                        <input type="hidden" name="objectId" id="objectId" value="1761792903328">
                        <div id="easyContainer"><input type="file" multiple="" class="fileInput"
                                style="display:none;"><a class="formBtn" id="btu_" style="color:#8C8686;"
                                href="javascript:void(0);">上传</a>
                            <div class="flist" style="margin-top: 0px;"></div>
                        </div>
                    </td>
                </tr>

            </tbody>
        </table>
    </form>


    <script>
        initSelect(1);//初始化选人框；1：默认根据部门

        initSelectDept();//初始化选择部门

        $("#applyUserName").click(function () {
            showSelect('applyUserName,applyUserId', 'text,id', '');
        });

        $("#projectName").click(function () {
            parent.addTabs("选择供应商评审表", contextPath + "system/qdzxapproval/approval/select_projectsupplier.html?_pfrid=" + $.getUrlParam("_frid"));
        });

        function setParams(id, name) {
            $("#projectName").val(name);
            $("#projectId").val(id);
            var txt = "<a href=\"javascript:viewProject(" + id + ");\">查看详情</a>";
            $("#toView").html(txt);
        }

        function viewProject(id) {
            var msg = "供应商评审表";
            var url = "projectsupplier_view.html?id=" + id;
            parent.addTabs("查看" + msg + "-" + id, contextPath + "system/qdzxapproval/approval/" + url + "&_pfrid=" + $.getUrlParam("_frid"));
        }

        function clearProject() {
            $("#projectName").val("");
            $("#projectId").val("");
            $("#toView").html("");
        }

        $("#approvalNames").click(function () {
            showSelect('approvalNames,approvalIds', 'text,id', 'checkAny');
        });

        $("#financename").click(function () {
            showSelect('financename,financeid', 'text,id', '');
        });

        $("#managername").click(function () {
            showSelect('managername,managerid', 'text,id', '');
        });

        $("#presidentname").click(function () {
            showSelect('presidentname,presidentid', 'text,id', '');
        });

        function checkFormMe(form) {

            return $('#my-form').form('validate');
        }

        function isOther(value) {
            if (value == "5") {
                $("#othertr").show();
            } else {
                $("#otherthing").val("");
                $("#othertr").hide();
            }
        }

        var type = $.getUrlParam("type");

        $("#type").val(type);

        var p_id = $.getUrlParam("id");
        var objectId = new Date().getTime();

        $("#objectId").val(objectId);

        var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/decorateContract' });
        var baseModel;

        if (p_id == null) {
            baseModel = new BaseModel();
        } else {
            baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
        }
        var baseView = new BaseView({ el: $("#my-form"), model: baseModel });


        function success(model, response, options) {
            var data = model.get("handleMsg");
            $.messager.alert('提示', model.get("handleMsg").message, 'info', function (rt) {
                if (data.status == 1) {
                    //图层解锁
                    //$("#myForm").unblock();
                    var subtitle = encodeURI(encodeURI($.getUrlParam("subtitle")));
                    window.parent.frames["" + $.getUrlParam("_pfrid")].location.reload();
                    window.location.href = contextPath + "system/qdzxapproval/approval/decoratecontract_edit.html?type=23&processid=" + model.get("id") + "&_pfrid=" + $.getUrlParam("_pfrid") + "&_frid=" + $.getUrlParam("_frid") + "&subtitle=" + subtitle;
                } else {
                    $("#errorMsg").html(data.message);
                    //图层解锁
                    //$("#myForm").unblock();
                }
            });
        }

        //附件
        $('#easyContainer').easyUpload({
            fileTypes: 'all',//all,image,file
            selectText: "上传",//上传按钮文案
            multi: true,//是否允许多文件上传  
            maxNum: 20,//文件上传最大个数
            maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
            showType: "flist",//展示方。flist,imglist
            fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
            url: contextPath + 'affix',//上传文件地址
            ajaxType: 'POST',//POST,GET
            fileName: 'file',//文件配置参数
            timeout: 300000,//请求超时时间
            formParam: { "objectId": objectId, "objectType": 232 },
        });


    </script>
    <div class="panel window" style="display: none; width: 450px; left: 425.5px; top: 25px;">
        <div class="panel-header panel-header-noborder window-header" style="width: 450px;">
            <div class="panel-title panel-with-icon">根据部门选择</div>
            <div class="panel-icon icon-manager"></div>
            <div class="panel-tool"><a class="panel-tool-collapse" href="javascript:void(0)"></a><a
                    class="panel-tool-close" href="javascript:void(0)"></a></div>
        </div>
        <div id="selectMan" class="easyui-window panel-body panel-body-noborder window-body" title=""
            data-options="closed:true,modal:true,iconCls:'icon-manager',minimizable:false,maximizable:false"
            style="z-index: 301; width: 450px; height: 325px;">
            <div id="selectManHead" class="datagrid-toolbar"><a class="easyui-linkbutton l-btn l-btn-plain"
                    iconcls="icon-ok" plain="true" onclick="checkSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-ok l-btn-icon-left">选择</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-reload" plain="true"
                    onclick="reload_data();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-reload l-btn-icon-left">刷新</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close" plain="true"
                    onclick="closeSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a></div>
            <div id="menu_tree" class="easyui-tree tree tree-lines" style="margin-top:35px;z-index: 300;"
                data-options="animate:true,lines:true,checkbox:true"></div>
        </div>
    </div>
    <div class="window-shadow" style="display: none; left: 425.5px; top: 25px;"></div>
    <div class="window-mask" style="width: 1301px; height: 605px; display: none;"></div>
    <div class="panel window" style="display: none; width: 350px; left: 475.5px; top: 10px;">
        <div class="panel-header panel-header-noborder window-header" style="width: 350px;">
            <div class="panel-title panel-with-icon">部门选择</div>
            <div class="panel-icon icon-manager"></div>
            <div class="panel-tool"><a class="panel-tool-collapse" href="javascript:void(0)"></a><a
                    class="panel-tool-close" href="javascript:void(0)"></a></div>
        </div>
        <div id="selectDept" class="easyui-window panel-body panel-body-noborder window-body" title=""
            data-options="closed:true,modal:true,iconCls:'icon-manager',minimizable:false,maximizable:false"
            style="width: 350px; height: 355px;">
            <div class="datagrid-toolbar"><a class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-ok" plain="true"
                    onclick="checkSelectDept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-ok l-btn-icon-left">选择</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-reload" plain="true"
                    onclick="reload_data_dept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-reload l-btn-icon-left">刷新</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close" plain="true"
                    onclick="closeSelectDept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a></div>
            <div id="menu_tree_dept" class="easyui-tree tree tree-lines"
                data-options="animate:true,lines:true,checkbox:true"></div>
        </div>
    </div>
    <div class="window-shadow" style="display: none; left: 475.5px; top: 10px;"></div>
    <div class="window-mask" style="width: 1301px; height: 605px; display: none;"></div>
</body>